/**
 * @Description 公用枚举键值对照表
 * @Date 2020-5-20
 */

/************** 正则相关 *********************/

/**
 * @description 正则表达式，判断是否为数字(包含小数点)
 */
export const regularTest = /^[+-]?\d*\.?\d*$/

/**
 * @description 正则表达式，判断是否为数字
 */
export const regularTest2 = /^\+?[0-9][0-9]*$/

/**
 * @description 正则表达式，判断是否包含汉字
 */
export const regularTest3 = new RegExp('[\\u4E00-\\u9FFF]+', 'g')

/**
 * @description 特殊字符过滤
 */
export const special = "[`~!@#$^&*()=|{}':;',\\[\\].<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]"

/**
 * @description 本地标识
 */
export const localhost = 'localhost'

/**
 * @description 本地IP标识
 */
export const localIP = '127.0.0.1'

//市价-最优N挡配置
export const orderPriceType = {
    3: '五',
    4: '十',
    5: '二十',
    6: '三十',
}

/**
 * @description 限价委托-订单类型
 */
export const orderTypeName = {
    1: 'IOC',
    2: 'FOK',
    3: 'maker only',
}

/**
 * @description 获取合约列表 最大数据条数
 */
export const countMaxPage = 500

//U本位标识
export const udsName = 'USD'

/**
 * @description 正向-维持保证金率-默认值
 */
export const MarginRatio = 0.005

/**
 * @description 正向手续费率
 */
export const servRateUSDT = 0.0007

/**
 * @description USDT对人民币汇率
 */
export const USDTCNY = 6.7

/**
 * @description 认证等级
 */
export const kycLevel = {
    1: 'KYC1',
    2: 'KYC1',
    3: 'KYC1',
}

/**
 * @description 资金费率对应时间表
 */
export const serverTimeArr = [8, 16, 24]

/**
 * 数量选择集合
 */
export const buyVolumeListEnmu = {
    0: '0%',
    25: '25%',
    50: '50%',
    75: '75%',
    100: '100%',
}

/**
 * @description 不需要登录的页面 路径集合
 */
export const noLoginPathEnmu = [
    '/register',
    '/download',
    '/support',
    '/helpcenter',
    '/blog',
    '/subscribe',
    '/articleList',
    '/notice',
    '/problem',
    '/otc',
    '/apply',
    '/missionCenter',
    '/contractInfo',
    '/apiPage',
    '/apiSpot',
    '/race',
    '/DCenter',
    '/usdt',
    '/cmc',
    '/explain',
    '/about',
    '/timeline',
    '/media',
    '/team',
    '/update',
    '/careers',
    '/careers/',
    '/spot/',
    '/spot',
    '/Spot/',
    '/Spot',
    '/market',
    '/Swap',
    '/Swap/',
    '/SwapU',
    '/SwapU/',
    '/SwapB',
    '/SwapB/',
    '/SwapC/',
    '/SwapC',
    '/fei',
    '/new-currency-list',
    '/coin-apply',
    '/community',
    '/tradeInfo',
    '/docs',
    '/live',
    '/room',
    '/welfarel',
    '/app',
    '/rewards',
    '/404',
    '/match',
    '/mobile/',
    '/mobile',
    '/verification',
    '/copy-trading',
    '/official-verification',
    '/appendmain',
    '/socialaccountauth',
    '/koldetail/',
    '/transit',
]

/**
 * @description 不需要头尾部页面路由名称集合
 */
export const noHeaderRouterNames = [
    'partner',
    'extendlink',
    'extendgroup',
    'friends',
    'subagent',
    'rebatelist',
    'dayDetail',
    'backlist',
    'userManage',
    'usermanage',
    'userList',
    'dealrecords',
    'entrustrecords',
    'positionrecords',
    'moneyinrecords',
    'moneyoutrecords',
    'activity',
    'activityDetail',
    'otc',
    'orderDetail',
    'orderList',
    'course',
    'setting',
    'spotIndex',
    'swapIndex',
    'swapUIndex',
    'swapCIndex',
    'swapBIndex',
    'otcadmin',
    'otcindex',
    'otcmessage',
    'otccollection',
    'otcorder',
    'race',
    'graphicRoom',
    'docs',
    'fileExplorer',
]

/**
 * @description XSS注入关键词屏蔽
 */
export const XSS = [
    'javascript',
    'JavaScript',
    'console',
    'iframe',
    'IFRAME',
    'document',
    'src',
    'SRC',
    'http',
    'HTTP',
    'appendChild',
    'onopen',
    'var',
    'let',
    'const',
    'onfocus',
    'eval',
    'localStorage',
    'getItem',
    'setItem',
    'sessionStorage',
    'alert',
    'WebSocket',
    'canvas',
    'script',
    'SCRIPT',
    'confirm',
    '<img',
    '<IMG',
    'οnmοuse',
    'οnerrοr',
    'print',
    'onload',
    '//',
    '\\',
    'STYLE',
    'style',
    'type=',
    'TYPE=',
    '<div',
    '</div',
    '<session',
    '</session',
    '<html',
    '</html',
    '<body',
    '</body',
    'echo',
    '<?',
    'href',
    '<a',
    '</a',
    'prompt',
    '<svg>',
    '</svg>',
]

/**
 * @description 用到现货、合约websocket页面
 */
export const wsRouter = {
    Spot: ['/', '/spot', '/Spot', '/markets', '/new-currency-list'],
    Swap: ['/', '/SwapU', '/Swap', '/SwapB', '/SwapC', '/markets', '/new-currency-list', '/follow-mine', '/my-home', '/match'],
}

/**
 * @description 链类型
 */
export const ChainTypeEnum = {
    ETH: 5,
    BTC: 6,
    EOS: 4,
    BCH: 7,
    DAI: 5,
    PAX: 5,
    USDT: 5,
}

/**
 * @description app安装包下载地址
 */
export const appStore = 'https://apps.apple.com/us/app/deepcoin-pro-trade-crypto/id1610058833'
export const googleStore = 'https://play.google.com/store/apps/details?id=com.deepcoin.app.global'
export const androidAPK = 'https://net-static-public.deepcoin.cool/android/channel/02/app-android2-release.apk'

/**
 * @description 语言对应币种 key值
 */
export const currenyKeyVal = { zh: 'valRmb', en: 'valUsd', ja: 'valJpy' }

/**
 * @description 币种对应缩写
 */
export const currenySym = {
    zh: 'CNY',
    en: 'USDT',
    ja: 'JPY',
    ru: 'RUB',
    idn: 'Rp',
    pt: 'CVE',
    ko: 'USDT',
}

/**
 * @description 开仓均价
 */
export const openingPrice = 10000

/**
 * @description 标记价格
 */
export const markPriceNum = 8988

/**
 * @description 合约美金价值
 */
export const dollarValue = 100

/**
 * @description tarker手续费率
 */
export const tarkerRate = 0.00075

/**
 * @description 手续费率
 */
export const servChangeRate = 0.0003

/**
 * @description 列表轮询时间
 */
export const tabListTimeNum = 6000

/**
 * @description 消息轮询时间
 */
export const notifyTimeNum = 30000

/**
 * @description 维持保证金率
 */
export const marginRate = 0.0006

/**
 * @description 开仓均价-容错小数
 */
export const faultTolerant = 0.00000001

/**
 * @description 吃单费率
 */
export const takeBillRate = 0.0003

/**
 * @description 数量小数位
 * 持仓量
 * 可平量
 * 成交量
 * 委托量
 */
export const numberNovel = 0

/**
 * @description 价格小数位
 * 开仓均价
 * 委托价
 * 成交价
 */
export const usdtNovel = 2

/**
 * @description 正向标识
 */
export const usdtName = 'USDT'

/**
 * @description BTC保留小数位数-
 * 手续费保留小数
 * 资金费用保留小数
 * 账户权益小数
 * 已实现盈亏
 * 未实现盈亏
 * 结算已实现盈亏
 */
export const btcNovel = 6

/**
 * @description 最小变动数量
 * 最小下单量
 */
export const minChangeN = 1

/**
 * @description 最小变动价位
 * 下单盘口
 */
export const minChangePriceN = 0.01

/**
 * @description 转账小数位
 */
export const transferAccNovel = 8

/**
 * @description 最大可设置杠杆倍数
 */
export const maxLevelNum = 125

/**
 * @description 小数位数
 */
export const decimalNum = 8

/**
 * @description 交易系统来源标识
 */
export const ExchangeID = 'DeepCoin'

/**
 * @description 交易系统-产品标识
 */
export const ProductGroup = 'Swap'

/**
 * @description 交易系统-产品标识-正向
 */
export const ProductGroupUSDT = 'SwapU'

/**
 * @description 交易系统-产品标识-USDC
 */
export const ProductGroupUSDC = 'SwapC'

/**
 * @description 交易系统-产品标识-BUSD
 */
export const ProductGroupBUSD = 'SwapB'

/**
 * @description 交易系统-产品标识-现货
 */
export const ProductGroupSpot = 'Spot'

/**
 * @description 交易系统-产品名称对应展示币种名称
 */
export const ProductNameObj = {
    SwapU: 'USDT',
    SwapC: 'USDC',
    SwapB: 'BUSD',
    Swap: 'USD',
    Spot: 'USDT',
}

/**
 * @description 产品类型对应的默认交易币种
 */
export const SwapType = [
    {
        Type: 'SwapU',
        DefaultcurrentId: 'BTCUSDT',
        PriceName: 'USDT',
    },
    {
        Type: 'SwapC',
        DefaultcurrentId: 'BTCUSDC',
        PriceName: 'USDC',
    },
    {
        Type: 'SwapB',
        DefaultcurrentId: 'BTCBUSD',
        PriceName: 'BUSD',
    },
    {
        Type: 'Swap',
        DefaultcurrentId: 'BTCUSD',
        PriceName: 'USD',
    },
    {
        Type: 'Spot',
        DefaultcurrentId: 'BTC/USDT',
        PriceName: 'USDT',
    },
]

/**
 * 来源标识-PC
 */
export const sourceName = 'pc'

//体验金标识
export const expCode = 'exp'

/**
 * @description 市价档位
 */
export const gearNumber = 10

/**
 * @description 校验正则
 */
export const regList = {
    nameReg: /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/,
    phoneReg: /^1\d{10}$/,
    emailReg: /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/,
    idcardReg:
        /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
    ipReg: /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/,
    maskReg:
        /^(254|252|248|240|224|192|128|0)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)$/,
    apiPwd: /^(?=.*\d)(?=.*?[a-z])(?=.*?[A-Z])(?=.*[~!@#$%^&*()=|{}':;',.<>/?~！—_@#￥……&*——|《》‘；\[\]：”“'。，、？【】（）])[\da-zA-Z~!@#$%^&*~!@#$%^&*()=|{}':;',.<>/?~！—_@#￥……&*——|《》‘；\[\]：”“'。，、？【】（）]{6,18}$/,
}

/**
 * @description 指标类型
 */
export const IndicatorTypeArr = ['', 'BOLL', 'MA', 'EMA']
/**
 * @description 导出最大时间限制
 */
export const maxDay = 86400000 * 731

/**
 * @description 导出-数据条数配置
 */
export const exportNum = 5000

/**
 * @description 官方渠道邀请码  test 36003676 pre 507793 prod 8916517
 */
let env = process.env.DOT_ENV
const codeJSON = {
    test: '36003676',
    pre: '507793',
    prod: '8916517',
    production: '8916517',
}
export const inviteCode = codeJSON[env]

/**
 * @description appid配置
 */
export let appKey = {
    appid: 547798,
    appsecret: '61dd6c49529a05569900e71f49a0cd87',
}

/**
 * @description 语言简码与中文描述映射
 */
export const langMap = new Map([
    ['zh', '中文'],
    ['ja', '日语'],
    ['en', '英语'],
    ['pt', '葡萄牙语'],
    ['ru', '俄语'],
    ['idn', '印尼语'],
    ['ko', '韩语'],
    ['tr', '土耳其语'],
])

/**
 * @description 合约对应类别名称->用于埋点读取值
 */
export const swapTypeName = { Swap: '币本位合约', SwapU: 'USDT永续', SwapC: 'USDC永续', SwapB: 'BUSD永续' }
